require(['jquery', 'cookie', 'app', 'lay'], function ($) {
    require(['vue'], function (Vue) {
        layui.use('form', function(){
            var form = layui.form;

            //监听提交
            form.on('submit(formDemo)', function(data){
                var jon=data.field;
                jon['city']=dic.that.city;
                jon['shopSpec']={uuid:new acquire().parameterMap['specId']};
                jon['uuid']=dic.that.uuid;
                var re=playAjax("ShopController/saveCitySpec",jon);
                alr(re.msg);
                return false;
            });
        });
        var dic = new Vue({
            el: ".vue-box"
            , data: {
                where: [],
                that: {
                    uuid:"",
                    city:{
                        uuid:"",
                        name:"",
                    },
                    money:""
                }
            }
            , created: function () {
                var uuid=new acquire().parameterMap['uuid'];
                if(uuid!=null){
                    this.that=playAjax("/ShopController/GetSpecCity",{uuid:uuid}).data;
                }
            }
            , methods: {
                referXadmin: function () {
                    window.location.reload();
                },
                opCity:function (e) {
                    var e = e.currentTarget;
                    layer.open({
                        type: 2
                        , content: "./14"
                        , area: ["800px", "400px"]
                        , btn: ['确定', '取消']
                        , yes: function (index, layero) {
                            debugger;
                            var body = layer.getChildFrame('body', index);
                            var w = $(layero).find("iframe")[0].contentWindow;
                            var jon = w.checkSure();
                            $(e).val(jon['city']);
                            debugger;
                            dic.that.city.uuid=jon['uuid'];
                            layer.closeAll();
                        }
                        , btn2: function (index, layero) {
                            layer.closeAll();
                        }
                        , cancel: function () {
                            layer.closeAll();
                        }
                    });
                }
            }
        });
    })
});
